<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><HTML><HEAD><style type="text/css">BODY {
//	background-color: #2D2D2D;
	font-family : Arial, Tahoma, Helvetica, sans-serif;
}

table#main {
	width: 1100px;
	background-color : #424242;
}

table#body, table#footer,table#header{
	width: 100%;
	background-color : #424242;
}


#body-left{
	width: 20%;
	background-color : inherit;
}

td#body-right{
	width: 20%;
	background-color : inherit;
}

td#body-mid{
	width: 60%;
	background-color : #FFFFFF;

}
 
table#header td{
	width:100%;
	background-color : inherit;	
}

table#footer td {
	width:100%;
	background-color : inherit;
}




/* .... */
PRE  {
     margin-left: 5%;
}

H3 {
	border-bottom: solid;
	border-width: 1px;
	padding: 5px;
	color : #990000;
	font-family : Verdana, Tahoma, Arial, Helvetica, sans-serif;
	font-size : 140%;
	margin-top : 2em;
}

BLOCKQUOTE {
	margin-left : 0;
}

TH {
	background-color : #FFFFFF;
}

TD {
	background-color : #F0F0F0;
}

</STYLE></HEAD><BODY>	<h1>Multi Rename Script</h1>

	<h3>Overview</h3>

	<p>Multi-Rename Script(<span class="caps">MRS</span>) is open source application for massive file renaming. It is not limited to finite number of rename actions. You can rename files based on any criteria and you can write your own. Its up to you if its going to be simple file name manipulation or complex one, like using database or Internet to get information about the new file name.</p>

	<p><span class="caps">MRS</span> is influenced by Total Commander&#8217;s (TC) Multi-Rename Tool. File name masks from TC will generally work unchanged. TC content plugins are also supported and automatically recognized if you have normal TC installation. This feature alone opens the world to Explorer&#8217;s Shell Extensions which can be used as rename mask providers. Its not necessary to have Total Commander installed for any of the <span class="caps">MRS</span> functionality. </p>

	<p>Additionally, <span class="caps">MRS</span> has its native plugin interface using AutoHotKey language. With basic programming experience you can extend file-rename operations. To create/change plugin or even <span class="caps">MRS</span> itself, nothing else but text editor is needed.</p>

	<p><txp:image name="MRS.png" wraptag="div" class="swimage"/></p>

	<h3>Features</h3>

	<ul>
		<li>Big number of file rename operations.</li>
		<li><span class="caps">AHK</span> plugins and support for Total Commander <a href="http://www.totalcmd.net/directory/content.html">content plugins</a>.</li>
		<li>Perl <a href="http://www.autohotkey.com/docs/misc/RegEx-QuickRef.htm">regular expressions</a> search &#38; replace.</li>
		<li>Real time preview for all files in the list.</li>
		<li>Undo, Presets, <span class="caps">MRU</span>s, configurable menus.</li>
		<li>No file limit, works equally fast with any number of files.</li>
		<li>Command line driving and Explorer Shell Extension.</li>
		<li>Unicode.</li>
		<li>Open source, developed in <a href="http://www.AutoHotkey.com">AutoHotKey</a> script so you can change any part of the program quickly.</li>
	</ul>

	<h3>Installation</h3>

	<p><span class="caps">MRS</span> is portable application. Just unpack the archive to the directory of your choice. <br />
In some systems you will have to add <span class="caps">MRS</span>.exe in Data Execution Prevention (<span class="caps">DEP</span>) list. You can do so using &#8220;System&#8221; Control Panel applet (<em>Advanced -&#62; Performance section -&#62; Data Execution Prevention</em> tab).</p>

	<p>To uninstall <span class="caps">MRS</span>, simply delete the directory. If you enabled shell extension you need to disable it first.</p>

	<h3>Integration</h3>

	<p>Although <span class="caps">MRS</span> can be used standalone, its the best to integrate it with your file manager. </p>

	<p><strong>Explorer</strong><br />
Enable Shell Extension ( <em>?-&#62;Settings-&#62;Enable Shell Extension</em> ).</p>

	<p><strong>Total Commander</strong><br />
Edit Start menu ( <em>Start-&#62;Change Start Menu</em> ) and use following settings: </p>

<pre><code>Title:		Multi-Rename Script
Command:	&#60;path_to_mrs&#62;\MRS.exe
Parameters:	AutoHotKey.ini %UL
Start In:	&#60;path_to_mrs&#62;
</code></pre>

	<p><code>%UL</code> parameter will make TC send Unicode List of files to <span class="caps">MRS</span> (requires TC 7.5++).</p>

	<p>You can also recall preset directly from the TC menu to be applied as soon as you activate the menu item, without showing the <span class="caps">MRS</span> <span class="caps">GUI</span>. To do so specify <span class="caps">MRS</span> preset after the <code>%UL</code> parameter or write new preset directly. For instance, to add counter to selected files using TC file list order, use above settings with following Parameters:</p>

<pre><code>Parameters:	AutoHotKey.ini %UL &#34;[C] [N]&#34;
</code></pre>

	<p>For other file managers procedure should be similar. See Command Line section for additional details.</p>

	<h3>Usage</h3>

	<p><strong>Rename</strong><br />
In <span class="caps">MRS</span>, you build up a new file names using name-masks, search &#38; replace and casing operations. File name mask is the string describing how to build up a new file name based on the currently processed file name and its position in the file list. Basic masks are always written between [ ]. Anything not among angular brackets is literal. To build up complete mask you concatenate basic masks and literal words. For instance, file name mask:</p>

<pre><code>No=[C:2] Name=[N4,10]
</code></pre>

	<p>renames files in the list so that new file names contain some literals (<code>No= Name=</code>), file number in the list specified with 2 digits (<code>[C:2]</code>) and 10 characters of original file name starting from 4th character (<code>[N4,10]</code>). The result for 2 files in the list is for instance:</p>

<pre><code>&#34;AFX-Lisbon Acid.mp3&#34;   ---&#62;   &#34;No=01  Name=Lisabon Acid.mp3&#34;
&#34;AFX-Pitcard.Mp3&#34;       ---&#62;   &#34;No=02  Name=Pitcard.Mp3&#34;
</code></pre>

	<p>There are 2 unrelated file masks, one that will be expanded to the new file name and one that will form the new file extension (File Extension Mask). You specify them in <em>File name mask</em> and <em>Ext mask</em> <span class="caps">GUI</span> fields. Both masks work the same way.</p>

	<p>After the mask, file name is processed with regular expression (RE) search &#38; replace. What you get is converted to appropriate case selected from the <em>Case</em> combo box.</p>

	<p>In the file list, you can see real time preview for your current rename operation. Once you build the mask you can press Start button to rename all files in the list. You can always restore previous names with Undo operation, even if you restart the application.</p>

	<p><strong>Report</strong><br />
You can use <span class="caps">MRS</span> to generate file and directory reports using plugins. The difference between renaming and reporting operation is simply that you don&#8217;t use <code>Start</code> button but <code>Editor Preview</code> instead to show generated text. This means that you can use all charachters desired, not only those allowed for the file names. For example, the following mask generates <span class="caps">CSV</span> file with details about each file in the list containing the file/directory name, number of files in the diretory, owner, full path, and creation date:</p>

<pre><code>[N];[=DirSizeCalc.File Count (on demand)] files;[=ShellDetails.Owner];[1-];[=ShellDetails.Date Created]
</code></pre>

	<p><txp:image name="MRS_scheme.gif" wraptag="div" class="swimage"/></p>

	<h3>Interface elements</h3>

	<p><strong>File name mask</strong><br />
File Name Mask. You can enter mask by typing, or you can expand <span class="caps">MRS</span> interface using expander on the middle of the <span class="caps">GUI</span> to select mask functions from mask categories.</p>

	<p><strong>Ext mask</strong><br />
File Extension Mask. All masks used for a file name can be used here.</p>

	<p><strong>Search &#38; Replace</strong><br />
Enter search and replace strings here. You can specify multiple criteria by using | separator (not with RE option enabled).<br />
For instance:
  Search for: <code>ä|ö|ü|</code>  Replace with: <code>ae|oe|ue</code></p>

	<p>If RE option is turned on search string is specified as <span class="caps">PERL</span> regular expression and you can use backreferences like <code>$1</code> in the replace field. There are number of regular expression options that can be set at the beginning of the search string followed by an close-parenthesis. For instance, the pattern <code>i)abc.*123</code> would turn on the case-insensitive option and search for &#8220;abc&#8221; followed by &#8220;123&#8221;.</p>

	<p><strong>Case</strong><br />
Specify case here to be applied finanally. To apply case on the parts of the file name, use case masks ( <code>[U], [L]</code> &#8230; ).</p>

	<p><strong>Expander</strong><br />
Pressing the little button on the middle of the top side of ListView control will expand user interface.<br />
Expanded interface contains buttons that will let you select rename-mask using categories. Button <em>Plugins</em> will show the menu with list of installed plugins.<br />
<span class="caps">AHK</span> plugins are shown bellow Total Commander plugins delimited by separator.</p>

	<p>There is also combo box with presets you saved. Type the name and press <span class="caps">ENTER</span> to save the preset. Type the preset name or use the combox box to select the preset. You can delete selected preset by pressing <code>DEL</code> key. Pressing <code>F12</code> will load default preset.</p>

	<p>You can change/add/remove entries from the button menus by editing <code>res\menus.ini</code> file. The format of this file is self explanatory.</p>

	<p><strong>File List</strong><br />
This is the list of files to be renamed. Double click the file to create range mask.</p>

	<p>You can add files using command line or drag &#38; drop.<br />
If you specify file name with the list of files as command line parameter, it will be used to populate the file list. The input file must contain one full file path per line.</p>

	<p>You can also add files to the list by dropping them with the mouse. If you drop files again, you will add to the current list unless you hold the <code>SHIFT</code> key.<br />
To remove selected files from the list, select them and press <code>DELETE</code> key.</p>

	<p>Double click the file in the list to set the <code>N</code> mask range based on its name.</p>

	<p><strong>Start</strong><br />
Launch rename operation. All renamed files will be removed from the list. Files that can not be renamed due to any kind of error will stay in the list and their Error column will contan error description.</p>

	<p><strong>Undo</strong><br />
Undo the last operation. There is only 1 undo and it will not be lost if you restart <span class="caps">MRS</span>.</p>

	<p><strong>Reload</strong><br />
Reload the result of the pervious rename operation to the list.</p>

	<p><strong>Preview in editor</strong><br />
Show preview for all files in the list in the editor. You can use this feature to edit the result manually before doing actual renaming. To do this, save preview in the FileInfo.txt under plugins folder, and use <code>[=FileInfo]</code> as file-rename mask.</p>

	<h3>Command line</h3>

	<p><span class="caps">MRS</span> accepts 2 command line arguments:</p>

<pre><code>MRS.exe AutoHotKey.ini [fileList] [presetDef]
</code></pre>

	<p><code>AutoHotKey.ini</code><br />
Must be set as the first parameter.</p>

	<p><code>fileList</code><br />
This is list of full system paths of files you want to rename, each on new line.</p>

	<p><code>presetDef</code><br />
This is preset definition to be used immediately on startup. <br />
Preset definition is string containing file mask, extension mask, search string, replace string, RE flag and case option separated by &#8220;&#62;&#8221; symbol. For instance <code>[N]&#62;[E]</code> is the same as you set file mask to [N] and extension mask to <code>[E]</code> and leaving all other options unchanged in <span class="caps">GUI</span>. </p>

	<p>Alternatively u can use preset name by specifying &#8220;&#62;&#8221; as the first character; for instance, you can write <code>&#34;&#62;Artist - Title&#34;</code> on command line to rename files in the <code>fileList</code> using already saved preset named <code>Artist - Title</code>.  Note that you must use quotation to specify preset name or it will be understood as command line redirection. <br />
The same preset definition is used in <span class="caps">MRS</span> configuration file to store presets and last used mask, so you can also copy/paste it from there.</p>

	<p>If presetDef is present on the command line, only progress bar will be shown and application will exit immediately after completing operation. <span class="caps">GUI</span> will be shown only if errors occured and it will contain list of problematic files with error descriptions.</p>

	<h3>Using plugins</h3>

	<p>Plugins extend the set of basic mask functions. Plugin may provide fields that can be used to specify what information to return about the file. Additionally, fields may have units to choose different format for the field data or specific information part.<br />
To specify plugin in file mask, use <code>[=plugin.field.unit]</code> notation. For instance mask:</p>

	<p>	<code>[N] [=Hash.CRC32] [=File.size.MB]MB ver[=Ver]</code></p>

	<p>will append crc32, file size in megabytes and version to the original file name.</p>

	<p>You can select range from plugin data using syntax:</p>

	<p>	<code>[=FileInfo:4-9]</code></p>

	<p>where range is used the same way as with <code>[N]</code> mask.</p>

	<p>TC plugin ShellDetails provides data from Explorer&#8217;s shell extensions.</p>

	<h3>Installing plugins</h3>

	<p><span class="caps">AHK</span> plugins are single <span class="caps">AHK</span> script files and they have .ahk extension. To install <span class="caps">AHK</span> plugin, simply copy it to the plugins folder and restart the application. To disable plugin, change its extension to anything but .ahk.</p>

	<p>About TC content plugins, <span class="caps">MRS</span> will try to find location of the <code>wincmd.ini</code> using system registry and if that fails, <code>COMMANDER_PATH</code> environment variable. It will then load all plugins found in TC configuration file. To override this behavior, set location of the <code>wincmd.ini</code> in the <span class="caps">MRS</span> configuration file, <code>MRS.ini</code> (Section: <code>Config</code>,  Key: <code>tcIni</code>).</p>

	<p>If you don&#8217;t have TC installed you can still use its content plugins. To install plugin without TC, simply copy it (or its folder) to <code>\plugins</code> folder. To use always plugins from the <span class="caps">MRS</span> plugins folder, no matter configuration of your local TC installation, set <code>tcIni=!</code> in <span class="caps">MRS</span>.ini <code>Config</code> section.</p>

	<p>To verify plugin installation expand <span class="caps">MRS</span> interface and click <em>Plugins</em> button. All installed plugins should be in the list.</p>

	<h3>Writing plugins</h3>

	<p>To Create <span class="caps">AHK</span> plugin nothing but the text editor is needed. Plugin interface is very simple:</p>

	<ul>
		<li>Name the file by the plugin. Don&#8217;t use single character as plugin name nor spaces.</li>
		<li>Plugin must implement 1 subroutine, with the same name as its own. It will receive some parameters about current file name that <span class="caps">MRS</span> is processing and it must return the result in the <code>#Res</code> variable. <code>#fn, #fe, #fp, #fd, #no</code> contain file name, file extension, file path, file directory and file number respectively.</li>
		<li>If it has more then 1 field, it must specify field names in the GetFields subroutine separated by new lines (in <code>#Res</code> variable, again). You can use &#8220;*&#8221; here to say that plugin accepts anything as field name (this can be used to pass arbitrary parameter to the plugin). <span class="caps">MRS</span> will later pass the filed name to the plugin as <code>#1</code> parameter to its main subroutine. To specify field unit, set units after the field name using &#8220;|&#8221; as separator.</li>
		<li>Use <code>\plugins\myplugin</code> file as a template for new plugin. You can use any AutoHotKey function when creating <span class="caps">AHK</span> plugin. Check out <span class="caps">AHK</span> documentation for details.</li>
		<li>Total commander plugins are dll&#8217;s so programming tools are required. Check out TC&#8217;s content plugin <span class="caps">SDK</span> for more information.</li>
	</ul>

	<h3>Masks</h3>

	<p>All masks except plugin names and fields are case sensitive. White space is allowed between mask name and its parameters.<br />
Maks are written betwen angular brackets: <code>[mask]</code></p>

	<table>
		<tr>
			<th>mask</th>
			<th>description</th>
		</tr>
		<tr>
			<td style="text-align:center;" colspan="2">File name</td>
		</tr>
		<tr>
			<td>N n-m</td>
			<td>From n to m, no m means &#8220;end&#8221;, no n means &#8220;start&#8221;</td>
		</tr>
		<tr>
			<td>N n,m</td>
			<td>From n, m.</td>
		</tr>
		<tr>
			<td>E n-m</td>
			<td>Extension</td>
		</tr>
		<tr>
			<td>C s+i:w</td>
			<td>Counter  S-start, i-increment, w-width</td>
		</tr>
		<tr>
			<td>P</td>
			<td>Parent dir</td>
		</tr>
		<tr>
			<td>G</td>
			<td>Grandparent dir</td>
		</tr>
		<tr>
			<td style="text-align:center;" colspan="2">Date Time</td>
		</tr>
		<tr>
			<td>Y</td>
			<td>Year in 4 digit form</td>
		</tr>
		<tr>
			<td>y</td>
			<td>Year in 2 digit form</td>
		</tr>
		<tr>
			<td>M</td>
			<td>Month, 2 digit</td>
		</tr>
		<tr>
			<td>D</td>
			<td>Day, 2 digit</td>
		</tr>
		<tr>
			<td>t</td>
			<td>Time, as defined in current country settings. : is replaced by a dot</td>
		</tr>
		<tr>
			<td>h</td>
			<td>Hours, always in 24 hour 2 digit format</td>
		</tr>
		<tr>
			<td>m</td>
			<td>Minutes, in 2 digit format</td>
		</tr>
		<tr>
			<td>s</td>
			<td>Seconds, in 2 digit format</td>
		</tr>
		<tr>
			<td style="text-align:center;" colspan="2">Case</td>
		</tr>
		<tr>
			<td>U</td>
			<td>All characters after this position in uppercase</td>
		</tr>
		<tr>
			<td>L</td>
			<td>All characters after this position in lowercase</td>
		</tr>
		<tr>
			<td>F</td>
			<td>First letter of each word uppercase after this position, all others lowercase</td>
		</tr>
		<tr>
			<td>n</td>
			<td>All characters after this position again as in original name (upper/lowercase unchanged)</td>
		</tr>
		<tr>
			<td style="text-align:center;" colspan="2">Plugins</td>
		</tr>
		<tr>
			<td>=Plugin</td>
			<td rowspan="3">3 ways to call plugins. Range can be specified with &#8216;:&#8217; using N notation: [=plugin:range]</td>
		</tr>
		<tr>
			<td>=Plugin.field</td>
		</tr>
		<tr>
			<td>=Plugin.field.unit</td>
		</tr>
		<tr>
			<td style="text-align:center;" colspan="2">Special</td>
		</tr>
		<tr>
			<td>[</td>
			<td>Opening square bracket</td>
		</tr>
		<tr>
			<td>]</td>
			<td>Closing square bracket</td>
		</tr>
	</table>

	<h3>About</h3>

	<p><span class="caps">MRS</span> is free, open source application. You are encouraged to modify any part of it and share it. If you write cool plugin consider sharing it (via forum for instance) and if its of general usability I will consider including it in the future versions.</p>

	<table>
		<tr>
			<td><strong>Developed by</strong>:</td>
			<td>Miodrag Milić</td>
		</tr>
		<tr>
			<td><strong>License</strong>:</td>
			<td><a href="http://creativecommons.org/licenses/BSD"><span class="caps">BSD</span></a></td>
		</tr>
		<tr>
			<td><strong>Contact</strong>:</td>
			<td> miodrag.milic@gmail.com</td>
		</tr>
		<tr>
			<td><strong>Location</strong>:</td>
			<td> Belgrade, Serbia</td>
		</tr>
	</table>

	<p><em>Last Changed:  09/02/2010</em></p>

</BODY></HTML>